import { createBrowserRouter } from 'react-router-dom';
import MainLayout from "../components/layout/MainLayout";
import HomePage from "../pages/Home/HomePage";
import AboutPage from "../pages/About/AboutPage";
import NotFoundPage from "../pages/NotFound/NotFoundPage";
import DocsPage from "../pages/DocsPage"; // 确保导入DocsPage
import JavaEnvSetupPage from "../pages/JavaSE/JavaEnvSetupPage"; // 导入Java环境搭建页面

export const router = createBrowserRouter([
  {
    path: "/",
    element: <MainLayout />, // 假设MainLayout是布局组件
    children: [
      {
        index: true,
        element: <HomePage />,
      },
      {
        path: "about",
        element: <AboutPage />,
      },
      {
        path: "docs/:docId", // 注意这里改为相对路径
        element: <DocsPage />,
      },
      {        
        path: "java/javase",
        element: <DocsPage />,
      },
      {        
        path: "frontend/html",
        element: <DocsPage />,
      },
      {        
        path: "ui/element-ui",
        element: <DocsPage />,
      },
      {        
        path: "computer/data-structure",
        element: <DocsPage />,
      },
      {        
        path: "database/mysql",
        element: <DocsPage />,
      },
      {        
        path: "framework/mybatis",
        element: <DocsPage />,
      },
      {        
        path: "spring/spring6",
        element: <DocsPage />,
      },
      {        
        path: "tools/common-utils",
        element: <DocsPage />,
      },
      {        
        path: "interview/algorithms",
        element: <DocsPage />,
      },



      {
        path: "java/javase/env-setup",
        element: <JavaEnvSetupPage />,
      },
      {
        path: "*",
        element: <NotFoundPage />,
      },
    ],
  },
]);